const send = require('koa-send')
const path = require('path')
// const utils = require('../utils')
// const uploadPath = require(__dirname, '../upload/')

exports.file = async function (ctx) {
  let { appName, fileName } = ctx.params
  let dir = path.join(__dirname, '../upload', appName)

  ctx.attachment(fileName)

  try {
    await send(ctx, fileName, { root: dir })
  } catch (e) {
    console.error(e)
  }
}